export default {
  created(){
    const setFontSize= () => {
      const htmlDom = document.getElementsByTagName('html')[0];
      let htmlWidth = document.documentElement.clientWidth || document.body.clientWidth;
      if (htmlWidth >= 750) {
        htmlWidth = 750;
      }
      if (htmlWidth <= 320) {
        htmlWidth = 320;
      }
      htmlDom.style.fontSize = `${htmlWidth / 7.5}px`

    };
    window.onresize = setFontSize;

    setFontSize()
  },
  lintOnSave: false,
  // axios: {
  //   baseURL: "https://api.artopia-group.com", // Used as fallback if no runtime config is provided
  // },
  server: {
    port: 3000, // default: 3000
    host: '0.0.0.0' // default: localhost,
  },
  axios: {
    baseURL: "http://voiceserver.51appdevelop.com/",
    // 开启代理 (如果需要判断线上线下环境，可以通过 process.env.NODE_ENV !== 'production' 来判断)
    proxy: true,
    // 给请求 url 加个前缀 /api，如果这项不配置，则需要手动添加到请求链接前面
    // 如果是多个代理的时候，则不需要配置，走手动添加代理前缀
    prefix: '/api',
    // 跨域请求时是否需要使用凭证
    credentials: true
  },
  proxy: {
    '/proxyapi': {
      // 目标接口域
      target: 'http://voiceserver.51appdevelop.com/',
      // 全局配置是否跨域
      changeOrigin: true,
      pathRewrite: {
        // 单个配置是否跨域
        // changeOrigin: true
        // 把 '/api' 替换成 '/'，具体需要替换为 '' 还是 '/' 看自己习惯
        '^/proxyapi': '/'
      }
    }
  },
  // Global page headers: https://go.nuxtjs.dev/config-head
  head: {
    title: 'voicenew',
    meta: [
      { charset: 'utf-8' },
      { name: 'viewport', content: 'width=device-width, initial-scale=1' },
      { hid: 'description', name: 'description', content: '' },
      { name: 'format-detection', content: 'telephone=no' },
      { name:"viewport",content:"width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" }
    ],
    link: [
      { rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }
    ],
    script: [
      // {
      //   src: "/rem.js",
      //   type: "text/javascript",
      //   charset: "utf-8"
      // }
    ]
  },

  // Global CSS: https://go.nuxtjs.dev/config-css
  css: [
  ],

  // Plugins to run before rendering page: https://go.nuxtjs.dev/config-plugins
  plugins: [
    // { src: "~plugins/axios" }
    '@/plugins/request.js',
    '@/plugins/request-plugin.js'
  ],

  // Auto import components: https://go.nuxtjs.dev/config-components
  components: true,

  // Modules for dev and build (recommended): https://go.nuxtjs.dev/config-modules
  buildModules: [
    // https://go.nuxtjs.dev/eslint
    // '@nuxtjs/eslint-module',
  ],

  // Modules: https://go.nuxtjs.dev/config-modules
  modules: [
    // https://go.nuxtjs.dev/bootstrap
    'bootstrap-vue/nuxt',
    // https://go.nuxtjs.dev/axios
    '@nuxtjs/axios',
    // https://go.nuxtjs.dev/pwa
    '@nuxtjs/pwa',
  ],

  // Axios module configuration: https://go.nuxtjs.dev/config-axios


  // PWA module configuration: https://go.nuxtjs.dev/pwa
  pwa: {
    manifest: {
      lang: 'zh'
    }
  },

  // Build Configuration: https://go.nuxtjs.dev/config-build
  build: {
    // vendor: ['axios'],//防止重复渲染
  }
}
